<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
  <head>
<meta charset="UTF-8"/>
    <title data-wyx-text="{qhTitle}"></title>
    <meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no" />
    <link type="image/x-icon" rel="shortcut icon" th:href="@{/img/favicon.png}" />
	<script src="/js/jquery-1.12.0.min.js" type="text/javascript"></script>
	<script src="/js/jquery.tools.js" type="text/javascript"></script>
	<script src="/v2/js/jquery.data.js" type="text/javascript"></script>
	<script src="/js/script.js" type="text/javascript"></script>
	
	<script src="/js/jquery.qrcode.min.js" type="text/javascript"></script>
	
    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <script src="/tools/echarts/echarts-all.js"></script>
    
    <script src="/tools/formValidator/formValidatorRegex.js"></script>
	<script src="/tools/formValidator/formValidator-4.1.1.js"></script>
    
    <script src="/js/jquery.form.js"></script>
    
    <link rel="stylesheet" type="text/css" href="/tools/jquery.alert/css/jjalert.css"/>
    <script src="/tools/jquery.alert/js/jjalert.js"></script>
    <script type="text/javascript">
    var timeInter= null;
    var retUrl;
    var qh = function(that){
    	if($(that).hasClass("login-qh-btn login-qh-dn")){
    		$.setData({qhClass:"login-qh-btn login-qh-code", qhTitle:"机构/老师扫描登录", qh:"code"});
    		var key = "tlogin:"+new Date().Format("yyyyMMddhhmmssS");
            $('#qrcode').qrcode({width: 130,height: 130,text: key});
            timeInter = setInterval(function(){
            	$.ajaxData({url:"login-code",isMask:false,type:"post",data:{key:key},success:function(url){
	            		/* var retUrl = getParam("retUrl");
	    				if(retUrl.indexOf('/org/acc/authentication') != -1 || retUrl.indexOf('/org/login') != -1 || retUrl == ''){
	    					retUrl = url;
	    				} */
	    				location.href = url;
    				},error:function(msg){
    				}
    			});
            },3000);
    	} else {
    		if(timeInter != null){
    			clearInterval(timeInter);
    		}
    		$("#qrcode").html("");
    		$.setData({qhClass:"login-qh-btn login-qh-dn", qhTitle:"机构/老师密码登录", qh:"dn"});	
    	}
    }
    $(function(){
    	$("#modal").addPath('');
    	$.formValidator.initConfig({validatorGroup:"1",formID:"loginForm",debug:false,onError:function(msg){$.jjalert(msg);}});
		$("#loginForm input[name='userName']").formValidator({tipID:"userNameTip",validatorGroup:"1",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,max:50,onError:"用户不能为空"});
		$("#loginForm input[name='password']").formValidator({tipID:"passwordTip",validatorGroup:"1",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,max:50,onError:"密码不能为空"});
		
		$("#loginForm").formsubmit({vg:"1",url:"login-login",type:"post", success:function(url){
				/* var retUrl = getParam("retUrl");
				if(retUrl.indexOf('/org/acc/authentication') != -1 || retUrl.indexOf('/org/login') != -1 || retUrl == ''){
					retUrl = url;
				} */
				location.href = url;
			}
		});
    	$.setData({qhClass:"login-qh-btn login-qh-dn", qhTitle:"机构/老师密码登录", qh:"dn"});	
    	//qh($("#qhBtn").get(0))
    });
    	
    </script>
  </head>
  <body>
  	<div id="modal"></div>
  	<!-- <script type="text/template" id="login"> -->
  	<div class="login">
  		<!--<div class="login-top">-->
  			<!--<div class="login-logo"><img src="/img/logo2.png"/></div>-->
  			<!--<div class="login-right">-->
	  			<!--<div class="login-menulist">-->
	  				<!--<span class="login-menu"><a href="">首页</a></span>-->
					<!--<span class="login-menu"><a href="">联系我们</a></span>-->
	  			<!--</div>-->
  			<!--</div>-->
  		<!--</div>-->
  		<div class="login-cont">
  			<div class="login-main">
  				<div class="login-main-top">
  					<div class="login-main-title" data-wyx-text="{qhTitle}"></div>
  					<div class="login-qh">
  						<span id="qhBtn" class="login-qh-btn" data-wyx-class="{qhClass}" onclick="qh(this)"></span>
  					</div>
  				</div>
  				<form id="loginForm">
  				<div class="login-form" data-wyx-if="{qh == 'dn'}">
  					
  					<input type="text" placeholder="用户名（手机）" name="userName" class="login-control"/>
  					<input type="password" placeholder="密码" name="password" class="login-control"/>
  					<button class="login-btn">登录</button>
  					
  				</div>
  				</form>
  				
  				<div class="login-form" data-wyx-if="{qh == 'code'}">
  					<div class="login-code"><div data="modal-static" id="qrcode" style="display: inline-block;"></div></div>
  					<div class="login-code-text">打开 <a>我要学APP/小程序</a> 扫一扫登录</div>
  				</div>
  				
  				<div class="login-group">
  					<span class="login-group-btn">忘记密码</span>
  					<span class="login-group-btn">下载我要学APP</span>
  				</div>
  			</div>
  		</div>
  	</div>
  	<!-- </script> -->
  </body>
</html>
